package io.renren.common.utils;

import org.apache.commons.lang.StringUtils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 时间转换工具
 */
public class TimeUtils {


    /**
     * string yyyy-MM-dd HH:mm:ss 转LocalDateTime
     * @param timeS
     * @return
     */
    public static LocalDateTime stringToLocalDateTime(String timeS) {

        if (!StringUtils.isBlank(timeS)) {
            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

            LocalDateTime ldt = LocalDateTime.parse(timeS,df);

            return ldt;
        }

        return null;
    }
}
